# from django.shortcuts import render
from rest_framework import viewsets

from utils.pagination import CustomPagination
from .models import LoginLog, QueryLog, OpLogs
from .serializers import LoginLogSerializer, QueryLogSerializer, OpLogsSerializer


# Create your views here.
class LoginLogViewSet(viewsets.ModelViewSet):
    """
    登录日志视图
    """
    queryset = LoginLog.objects.all().order_by('id')
    serializer_class = LoginLogSerializer


class QueryLogViewSet(viewsets.ModelViewSet):
    """
    查询日志视图
    """
    queryset = QueryLog.objects.all().order_by('id')
    serializer_class = QueryLogSerializer
    pagination_class = CustomPagination


class OptLogViewSet(viewsets.ModelViewSet):
    """
    操作日志视图
    """
    queryset = OpLogs.objects.all().order_by('id')
    serializer_class = OpLogsSerializer
    pagination_class = CustomPagination
